package com.framework.bas.util.linq;

import java.util.List;

import org.dom4j.Element;

public class Linq<E> {

	private ILinq linq;
	private FilterManager fm = new FilterManager();

	public Linq<E> from(List<E> list){
		this.linq = new ListLinq<E>(list);
		return this;
	}
	public Linq<E> from(Element element){
		this.linq = new XmlLinq(element);
		return this;
	}
	
	public Linq<E> addFilter(IFilter filter){
		fm.add(filter);
		return this;
	}
	
	@SuppressWarnings("unchecked")
	public List list(){
		List list = fm.filter(linq);
		return list;
	}
}
